import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../controllers/sign_up_controller.dart';

class SignUpView extends GetView<SignUpController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('注册'),
        centerTitle: true,
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              height: Get.height * .36,
              margin: EdgeInsets.only(top: 50, left: 30, right: 30),
              alignment: Alignment.bottomCenter,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  TextField(
                    controller: controller.accountTec,
                    keyboardType: TextInputType.number,
                    autofocus: true,
                    decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        contentPadding: EdgeInsets.all(10.0),
                        prefixIcon: Icon(Icons.phone),
                        hintText: '请输入账号',
                        labelText: '手机号'),
                  ),
                  TextField(
                      controller: controller.pwdTec,
                      keyboardType: TextInputType.number,
                      decoration: InputDecoration(
                          border: OutlineInputBorder(),
                          contentPadding: EdgeInsets.all(10.0),
                          prefixIcon: Icon(Icons.key),
                          hintText: '请输入密码',
                          labelText: '密码'),
                      obscureText: true),
                  TextField(
                      controller: controller.nicknameTec,
                      keyboardType: TextInputType.text,
                      decoration: InputDecoration(
                          border: OutlineInputBorder(),
                          contentPadding: EdgeInsets.all(10.0),
                          prefixIcon: Icon(Icons.account_box_outlined),
                          hintText: '请设置昵称',
                          labelText: '昵称'),
                      ),
                ],
              ),
            ),
            SizedBox(
              width: Get.width * .4,
                child: ElevatedButton(
              onPressed: () {
                controller.signUp();
              },
              child: Text("注 册"),
            )),
          ],
        ),
      ),
    );
  }
}
